package com.iqismart.shorturl.model;

import org.hibernate.annotations.Proxy;

import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.MappedSuperclass;
import java.io.Serializable;

/**
 * @Description
 * @Auther sty
 * @createTime 2019-10-14 11:24
 */
@MappedSuperclass
@Proxy(lazy = false)
public abstract class BaseEntity<T> implements Serializable {
    protected Long id;
    protected Long createTime = System.currentTimeMillis();
    protected Long updateTime = System.currentTimeMillis();


    public BaseEntity(){
    }

    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public Long getCreateTime() {
        return createTime;
    }

    public void setCreateTime(Long createTime) {
        this.createTime = createTime;
    }

    public Long getUpdateTime() {
        return updateTime;
    }

    public void setUpdateTime(Long updateTime) {
        this.updateTime = updateTime;
    }

    public abstract T toResponse();
}

